package com.user.config;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cloud.domain.TbUser;
import com.user.dao.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @version 1.0
 * @author: yu.tan
 * @date: 2020/10/25 10:09
 * @Description:
 */
@Slf4j
@Component
public class TestConfig {

    @Autowired
    private UserMapper userMapper;

    @PostConstruct
    @Bean("OneUser")
    public TbUser getTest(){
        log.info("开始加载");
        QueryWrapper<TbUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",1);

        TbUser one = userMapper.selectOne(queryWrapper);


        log.info("数据加载完毕：{}",one);
        return one;
    }


}
